<include file="Public/head"/>
<link href="__PUBLIC__/layui/css/layui.css" rel="stylesheet" type="text/css" />
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
<style>
table th{
    font-size: 19px;
    color:#000;
}
table td{
    font-size: 16px;
    /*color:#000;*/
}
#dao select{
    font-size:17px;
    margin-left: -40px;
}

</style>
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>
                    <div class="row">
                    <div class="col-xs-12">
                        
                        <div style="float:left;margin-top:3px;margin-right:0px;width:10%;font-size:16px;">
                            
                                <input type="button"  value="导入集团绩效表格" class=" btn-info"  style="width:130px;height:50px;" onclick="dao()"    />
                        
                        </div>
                        <!-- <div style="float:left;margin-top:3px;margin-right:0px;width:10%;font-size:16px;">
                            
                                <input type="button"  value="导入医院绩效表格" class=" btn-info"  style="width:130px;height:50px;" onclick="dao()"    />
                        
                        </div> -->
                        <div style="margin-top:5%;"></div>
                        <!-- <form id="form" method="post" action="{:U('Shenp/ytong')}" style="margin-top:5%;"> -->
                        <table class="table table-hover" id="wcai">
                            <thead>
                                <tr>
                                    <!-- <th class="center"><input class="check-all" type="checkbox" value=""></th> -->
                                    <th class="center">
                                        <div class="input-group" style="width:125px;">
                                          <input type="text" class="form-control" name="uname" placeholder="考核人搜索" style="width:100px;margin-left:20px;height:40px" id="suser"> 
                                          <span class="input-group-btn" style="float:left;">
                                            <button class="layui-btn layui-btn-primary layui-btn-radius" type="button" style="height:40px;"><p style="line-height:40px;" onclick="sou(this)">Go!</p></button>
                                          </span>
                                        </div><!-- /input-group -->
                                    </th>
                                    <th class="center" style="float:left;">
                                        <div class="layui-input-block" style="width:100px;margin-left:15%;" >
                                          <select name="interest" lay-filter="aihao" style="text-align:center;height:40px;" id="one">
                                                <option value="0" >所属岗位/部门</option>
                                            <volist name="ment" id="k">
                                                
                                                <option value="{$k.bu}">{$k.bu}</option>
                                            </volist>
                                            
                                           
                                            
                                          </select>
                                        </div>

                                    </th>
                                    <!-- <th class="center">所属岗位</th> -->
                                    <th class="center">
                                        <div class="layui-input-block" style="width:100px;margin-left:15%;" >
                                          <select name="interest" lay-filter="aihao" style="text-align:center;height:40px;" id="tow">
                                                <option value="0">绩效开始时间</option>
                                            <volist name="k_time" id="k">
                                                
                                                <option value="{$k.j_time}">{$k.j_time}</option>
                                            </volist>
                                            
                                           
                                            
                                          </select>
                                        </div>
                                    </th>
                                    <th class="center">绩效结束时间</th>
                                    <th class="center">表格类型</th>
                                    <th class="center">得分</th>
                                    <th class="center">操作</th>
                                </tr>
                            </thead>
                            <tbody id="trl">
                                <volist name="list" id="v">
                                    <tr>
                                        <!-- <td class="center">
                                            <input class="uids" type="checkbox" name="uids[]" value="{$v['id']}">
                                        </td> -->
                                        <td class="center">{$v.uname}</td>
                                        <td class="center">{$v.ment}</td>
                                        <!-- <td class="center">{$v.post}</td> -->
                                        <td class="center">{$v.k_time}</td>
                                        <td class="center">{$v.e_time}</td>
                                        <td class="center">{$v.bming}</td>
                                        <?php if(empty($v['score'])): ?>
                                            <td class="center" id="fen" onclick="cha({$v.id},{$v.k_time},this)" style="width:200px;"><a  style="color:#00f;margin:0px 30%;text-decoration:underline;cursor:pointer;" id="a">查看得分</a></td>
                                        <?php else: ?>
                                            <td class="center" id="fen" style="color:#00a497">{$v.score}</td>
                                        <?php endif ?>
                                        <td class="center">
                                        <a href="{:U('xiang',array('uid'=>$v['uid'],'yue'=>$v['k_time'],'e_time'=>$v['e_time'],'bu'=>$v['ment']))}" class="layui-btn layui-btn-normal  layui-btn-radius">查看表</a>
                                        <button class="layui-btn layui-btn-danger layui-btn-radius" onclick="del({$v.id},this)">删除</button>
                                        </td>
                                       
                                    </tr>  
                                </volist>
                            </tbody>

                        </table>
                        {$page}
                        <!-- </form> -->

                 
                    </div>
                    </div>
    <div id="dao" class="row" style="display:none;width:100%;"> 
        <form action="{:U('eadd')}" style="margin-left:20%;" method="post" enctype="multipart/form-data">
        <div class="form-group">
            <label for="exampleInputEmail1" style="margin-top:10px;margin-left:-40px;font-size:19px;">考核部门:</label>
            <select class="form-control" name="bu" style="width:400px;text-align:center;" id="cattype">
                <volist name="glist" id="g">
                    <if condition="$g['post'] neq ''">
                        <option value="{$g.post}">{$g.post}</option>
                    <else/>
                        <option value="">请选择</option>
                    </if>
                    
                   
                </volist>
            </select>
        </div>

       <div class="form-group">
            <label for="exampleInputEmail1" style="margin-top:10px;margin-left:-40px;font-size:19px;">考核岗位:</label>
            <select class="form-control" name="post" style="width:400px;text-align:center;" id="catchild">
                <option value="">请选择</option>
            </select>
        </div>

        <div class="form-group">
            <label for="exampleInputEmail1" style="margin-top:10px;margin-left:-40px;font-size:19px;">考核人:</label>
            <select class="form-control" name="uname" style="width:400px;text-align:center;" id="user">
                <option value="">请选择..(如不选,则为全部;)</option>
            </select>
        </div>

        <div class="form-group">
            <label for="exampleInputEmail1" style="margin-top:10px;margin-left:-40px;font-size:19px;">绩效月:</label><br>
            <input type="date" name="j_time" style="width:400px;margin-left:-40px;">
        </div>
        
        <input  type="file" name="file" style="margin-top:40px;" />
                        
        <button type="submit" class="btn-info" style="width:85px;height:40px;font-size:17px;margin-left:30%;margin-top:20px;">确定导入</button>


        </form>


    </div>
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script src="__PUBLIC__/qwadmin/js/date-time/bootstrap-datepicker.js"></script>
<!-- <script src="__PUBLIC__/qwadmin/js/function.js"></script> -->
<script src="__PUBLIC__/layer/layer.js"></script>
<script type="text/javascript">
//表格删除事件
function del(id,obj)
{
    // console.log(k_time);
    //询问框
    layer.confirm('确定选择么 ( ・◇・)？', {
      btn: ['确定','取消'] //按钮
    }, function(){
         $.ajax({
             type: "POST",
             url:"{:U('del')}",
             data:{'id':id},// 要提交的表单 
             beforeSend:function(){
                   layer.load(0, {shade: false});
                },
             success: function(msg) {
                // console.log(msg);
                // if (msg == 1111) {
                //     layer.msg('添加成功~', {icon: 1});
                //     history.go(0); 
                // }else{
                //     layer.msg('添加失败！', {icon: 2});
                // }
             },
             complete: function() {
                     layer.closeAll('loading');
                }
         });
     
    }, function(){
        layer.msg(' (｡・`ω´･) 再见');
    });   
}
//用户搜索事件
function sou(obj)
{
    var uname = $('#suser').val();
    // console.log(uname);
     $.ajax({
         type: "POST",
         url:"{:U('sou')}",
         data:{"uname":uname},// 要提交的表单 
         beforeSend:function(){
               layer.load(0, {shade: false});
            },
         success: function(data) {
            if (data != '1111') {
                 $('td').remove();
                 for (var i = 0; i < data.length; i++) {
                         // console.log(data);
                    $("<tr><td class='center' >"+data[i].uname+"</td><td class='center'>"+data[i].ment+"</td><td class='center'>"+data[i].k_time+"</td><td class='center'>"+data[i].e_time+"</td><td class='center'>绩效考核表</td><td class='center'></td><td class='center'><a href='{:U('xiang',array('uid'=>$v['uid'],'yue'=>$v['k_time'],'e_time'=>$v['e_time'],'bu'=>$v['ment']))}' class='layui-btn layui-btn-normal  layui-btn-radius'>查看表</a><button class='layui-btn layui-btn-danger layui-btn-radius' onclick='del({$v.id},this)'>删除</button></td></tr>").appendTo('#wcai');
                    // $('#bfan').show();
                    // $('#bfen').hide();
                   
                   
                }  
                    
            }else {
                $('td').remove();
                $("<td class='center' colspan='7' id='lmei'><h1 style='font-size:25px;'>没有搜索到!!!</h1></td>").appendTo('#trl');
            }
         },
         complete: function() {
                 layer.closeAll('loading');
            }
     });
}
//导入弹出
function dao()
{
    layer.open({
        type: 1,
        title:  ['导入绩效表格', 'font-size:17px;'],
        skin: 'demo-class', //加上边框
        area: ['500px', '550px'], //宽高
        content: $('#dao'),
        // btn:'按钮'
    });
}
//给下拉框设置事件
$("#one").change(function(){
    
    var ment = this.value;
    var k_time = $('#tow').val();
    var type = '0';
    // console.log(ment);
    // console.log(k_time);
     //询问框
    $.ajax({
         type: "POST",
         url:"{:U('xcha')}",
         data:{"ment":ment,"k_time":k_time,'type':type},// 要提交的表单 
         beforeSend:function(){
               layer.load(0, {shade: false});
            },
         success: function(data) {
            if (data != '1111') {
                    for (var i = 0; i < data.length; i++) {
                        $('td').remove();
                        for (var i = 0; i < data.length; i++) {
                                 // console.log(data);
                            $("<tr><td class='center' >"+data[i].uname+"</td><td class='center'>"+data[i].ment+"</td><td class='center'>"+data[i].k_time+"</td><td class='center'>"+data[i].e_time+"</td><td class='center'>绩效考核表</td><td class='center'></td><td class='center'><a href='{:U('xiang',array('uid'=>$v['uid'],'yue'=>$v['k_time'],'e_time'=>$v['e_time'],'bu'=>$v['ment']))}' class='layui-btn layui-btn-normal  layui-btn-radius'>查看表</a><button class='layui-btn layui-btn-danger layui-btn-radius' onclick='del({$v.id},this)'>删除</button></td></tr>").appendTo('#wcai');
                            // $('#bfan').show();
                            // $('#bfen').hide();
                   
                   
                        }  
                       
                    }
            }else{
                $('td').remove();
                $("<td class='center' colspan='7' id='lmei'><h1 style='font-size:25px;'>没有搜索到!!!</h1></td>").appendTo('#trl');
            }
         },
         complete: function() {
                 layer.closeAll('loading');
            }
     });
   
})

//给下拉框设置事件
$("#tow").change(function(){
    
    var k_time = this.value;
    var ment = $('#one').val();
    var type = '1';
    // console.log(ment);
    // console.log(k_time);
     //询问框
    $.ajax({
         type: "POST",
         url:"{:U('xcha')}",
         data:{"ment":ment,"k_time":k_time,'type':type},// 要提交的表单 
         beforeSend:function(){
               layer.load(0, {shade: false});
            },
         success: function(data) {
            if (data != '1111') {
                    for (var i = 0; i < data.length; i++) {
                        $('td').remove();
                        for (var i = 0; i < data.length; i++) {
                                 // console.log(data);
                            $("<tr><td class='center' >"+data[i].uname+"</td><td class='center'>"+data[i].ment+"</td><td class='center'>"+data[i].k_time+"</td><td class='center'>"+data[i].e_time+"</td><td class='center'>绩效考核表</td><td class='center'></td><td class='center'><a href='{:U('xiang',array('uid'=>$v['uid'],'yue'=>$v['k_time'],'e_time'=>$v['e_time'],'bu'=>$v['ment']))}' class='layui-btn layui-btn-normal  layui-btn-radius'>查看表</a><button class='layui-btn layui-btn-danger layui-btn-radius' onclick='del({$v.id},this)'>删除</button></td></tr>").appendTo('#wcai');
                            // $('#bfan').show();
                            // $('#bfen').hide();
                   
                   
                        }  
                       
                    }
            }else{
                $('td').remove();
                $("<td class='center' colspan='7' id='lmei'><h1 style='font-size:25px;'>没有搜索到!!!</h1></td>").appendTo('#trl');
            }
         },
         complete: function() {
                 layer.closeAll('loading');
            }
     });
   
})



//联动事件
$("#cattype").change(function(){
var catid = this.value; //获取切换的类别的id
// console.log(catid);
$.getJSON("{:U('index')}",{catid:catid},function(data){
    console.log(data);
$('#catchild option[value!=""]').remove(); //清空option 每次改变option的时候载入新的数据
// //alert(data.length);
if(catid==''){
vals="<option value=''>"+data+"</option>";
$(vals).appendTo("#catchild");
}else{
for(var i=0;i<data.length;i++){
    // console.log(data[i].post);
var vals='';
vals+="<option value="+data[i].post+" style='color:#007b43'>"+data[i].post+"</option>";
$(vals).appendTo("#catchild");
}
}

})
});
$("#catchild").change(function(){
var post = this.value; //获取切换的类别的id
// console.log(post);
$.getJSON("{:U('index')}",{post:post},function(msg){
    console.log(msg);
$('#user option[value!=""]').remove(); //清空option 每次改变option的时候载入新的数据
// //alert(data.length);
if(post==''){
vals="<option value=''>"+msg+"</option>";
$(vals).appendTo("#user");
}else{
for(var i=0;i<msg.length;i++){
    // console.log(data[i].post);
var vals='';
vals+="<option value="+msg[i].user+" style='color:#f8b862'>"+msg[i].user+"</option>";
$(vals).appendTo("#user");
}
}

})
});




function cha(id,time,obj)
{
    $.ajax({
         type: "POST",
         url:"{:U('cha')}",
         data:{"id":id,'time':time},
         beforeSend:function(){
               layer.load(0, {shade: false});
            },
         success: function(msg) {
            if (msg == 2222) {
                layer.msg('暂无得分', {icon: 2});
                // history.go(0); 
            }else{
                if (msg == 3333) {
                    layer.msg('查询失败', {icon: 2});
                }else{
                    $('#a').remove();
                    $(obj).text(msg);
                    $(obj).css({'color':'#00a497'})
                }
            }
         },
         complete: function() {
                 layer.closeAll('loading');
            }
    });
            
}



</script>
</body>
</html>



